<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>微分享-后台管理系统</title>
    <meta name="description" content="微分享-后台管理系统"/>
    <meta name="keywords" content="index"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="shortcut icon" th:href="@{/static/img/favicon.ico}" />
    <link rel="stylesheet" th:href="@{/static/assets/css/amazeui.min.css}"/>
    <link rel="stylesheet" th:href="@{/static/assets/css/admin.css}"/>
    <link rel="stylesheet" th:href="@{/static/lib/jquery-file-upload/css/jquery.fileupload.css}"/>
    <link rel="stylesheet" th:href="@{/static/lib/layer/skin/layer.css}" />
    <script th:src="@{/static/assets/js/jquery.min.js}"></script>
    <script th:src="@{/static/assets/js/amazeui.min.js}"></script>
    <script th:src="@{/static/assets/js/app.js}"></script>
    <script th:src="@{/static/js/public.js}"></script>
	<script type= "text/javascript" th:src ="@{/static/lib/layer/layer.js}"></script>   
	<script type= "text/javascript" th:src ="@{/dwr/util.js}"></script>   
	<script type="text/javascript" th:src= "@{/dwr/engine.js}"></script > 
	<script type="text/javascript" th:src= "@{/dwr/interface/NoticeContentController.js}"></script>
	<script type="text/javascript" th:src= "@{/static/js/dwrhelp.js}"></script>
	<script th:src="@{/static/lib/jquery-file-upload/js/vendor/jquery.ui.widget.js}"></script>
	<script th:src="@{/static/lib/jquery-file-upload/js/jquery.iframe-transport.js}"></script>
	<script th:src="@{/static/lib/jquery-file-upload/js/jquery.fileupload.js}"></script>
    <style type="text/css">
    	.bar {
		    height: 18px;
		    background: green;
		}
    </style>
</head>
<body>
<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->

<header class="am-topbar am-topbar-inverse admin-header">
  <div class="am-topbar-brand">
    <strong>Amaze UI</strong> <small>后台管理模板</small>
  </div>

  <button class="am-topbar-btn am-topbar-toggle am-btn am-btn-sm am-btn-success am-show-sm-only" data-am-collapse="{target: '#topbar-collapse'}"><span class="am-sr-only">导航切换</span> <span class="am-icon-bars"></span></button>

  <div class="am-collapse am-topbar-collapse" id="topbar-collapse">

    <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list">
      <li class="am-dropdown" id="am-dropdown">
        <a class="am-dropdown-toggle"  href="javascript:;">
          <span class="am-icon-users"></span> 管理员<span th:text="${session.userName}"></span><span class="am-icon-caret-down"></span>
        </a>
        <ul class="am-dropdown-content">
         	 <li><a th:href="@{/admin-user}"><span class="am-icon-user"></span> 资料</a></li>
		     <li><a href="logout"><span class="am-icon-power-off"></span> 退出</a></li>
        </ul>
      </li>
      <li class="am-hide-sm-only"><a href="javascript:;" id="admin-fullscreen"><span class="am-icon-arrows-alt"></span> <span class="admin-fullText">开启全屏</span></a></li>
    </ul>
  </div>
</header>

<div class="am-cf admin-main">
  <!-- sidebar start -->
  <div class="admin-sidebar am-offcanvas" id="admin-offcanvas">
    <div class="am-offcanvas-bar admin-offcanvas-bar">
        <ul class="am-list admin-sidebar-list">
             <li><a href="admin_index"><span class="am-icon-home"></span>内容管理</a></li>
             <li><a href="admin_users"><span class="am-icon-table"></span>用户管理</a></li>
             <li><a href="admin_add_pictureshare"><span class="am-icon-table"></span>添加分享</a></li>
			 <li><a href="register"><span class="am-icon-table"></span>管理员注册</a></li>
             <li><a href="logout"><span class="am-icon-sign-out"></span> 注销</a></li>
        </ul>
      <div class="am-panel am-panel-default admin-sidebar-panel">
        <div class="am-panel-bd">
          <p><span class="am-icon-bookmark"></span> 公告</p>
          <p>时光静好，与君语；细水流年，与君同。—— Amaze UI</p>
        </div>
      </div>

      <div class="am-panel am-panel-default admin-sidebar-panel">
        <div class="am-panel-bd">
          <p><span class="am-icon-tag"></span> wiki</p>
          <p>Welcome to the Amaze UI wiki!</p>
        </div>
      </div>
    </div>
  </div>
  <!-- sidebar end -->

  <!-- content start -->
  <div class="admin-content">
    <div class="admin-content-body">
      <div class="am-cf am-padding am-padding-bottom-0">
        <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">设置头像</strong> / <small>Personal information</small></div>
      </div>

      <hr/>

      <div class="am-g">
        <div class="am-u-sm-12 am-u-md-4 am-u-md-push-8">
          <div class="am-panel am-panel-default">
            <div class="am-panel-bd">
              <div class="am-g">
                <div class="am-u-md-4">
                  <img id="head" class="am-img-circle am-img-thumbnail" src="myavotar" alt=""/>
                </div>
                <div class="am-u-md-8">
                  <p>你可以使用<a href="#">gravatar.com</a>提供的头像或者使用本地上传头像。 </p>
                  <form class="am-form">
                    <div class="am-form-group">
                      <input id="fileupload" type="file"  name="filesImage"/>
                      <p class="am-form-help">请选择要上传的文件...</p>
                    </div>
                  </form>
                </div>
              </div>
            </div>
          </div>
        </div>

        <!-- The global progress bar -->
	    <div id="progress" class="progress">
	        <div class="bar"  style="width: 0%;"></div>
	    </div>

<!--         <div class="am-u-sm-12 am-u-md-8 am-u-md-pull-4"> -->
<!--           <form class="am-form am-form-horizontal"> -->
<!--             <div class="am-form-group"> -->
<!--               <label for="user-name" class="am-u-sm-3 am-form-label">姓名 / Name</label> -->
<!--               <div class="am-u-sm-9"> -->
<!--                 <input type="text" id="user-name"  placeholder="姓名 / Name"/> -->
<!--                 <small>输入你的名字，让我们记住你。</small> -->
<!--               </div> -->
<!--             </div> -->

<!--             <div class="am-form-group"> -->
<!--               <label for="user-email" class="am-u-sm-3 am-form-label">电子邮件 / Email</label> -->
<!--               <div class="am-u-sm-9"> -->
<!--                 <input type="email" id="user-email" placeholder="输入你的电子邮件 / Email"/> -->
<!--                 <small>邮箱你懂得...</small> -->
<!--               </div> -->
<!--             </div> -->

<!--             <div class="am-form-group"> -->
<!--               <label for="user-phone" class="am-u-sm-3 am-form-label">电话 / Telephone</label> -->
<!--               <div class="am-u-sm-9"> -->
<!--                 <input type="tel" id="user-phone" placeholder="输入你的电话号码 / Telephone"/> -->
<!--               </div> -->
<!--             </div> -->

<!--             <div class="am-form-group"> -->
<!--               <div class="am-u-sm-9 am-u-sm-push-3"> -->
<!--                 <button type="button" class="am-btn am-btn-primary">保存修改</button> -->
<!--               </div> -->
<!--             </div> -->
<!--           </form> -->
<!--         </div> -->
      </div>
    </div>

      <footer class="admin-content-footer">
            <p class="am-padding-left">周航@成都信息工程大学, All Rights Reserved.</p>
      </footer>

  </div>
  <!-- content end -->

</div>

<a href="#" class="am-icon-btn am-icon-th-list am-show-sm-only admin-menu" data-am-offcanvas="{target: '#admin-offcanvas'}"></a>
<script>
/*<![CDATA[*/
  function suffix(file_name){
     var result =/\.[^\.]+/.exec(file_name);
     return result;
  }
               
    $(function(){
    	 'use strict';
   	  $('#fileupload').fileupload({
   		  autoUpload: true,
   		  acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
   		  maxNumberOfFiles : 1,
   		  url:'/uploadImg'  ,
   	 	  add:function (e, data) {
   	 		var name = data.files[0].name;
   	 	    var mime = name.toLowerCase().substr(name.lastIndexOf(".")); 
   	 		console.info(mime);
   	 		if(mime!=".jpg" && mime!=".png" && mime!=".gif") {
   	 		 	alert('只能上传jpg,png,gif等格式的图片');
   	 			return;
   	 		} else {
   	 			data.submit();
   	 		}
   	 	  },
  	        done: function (e, data) {
  	           var res = data.result;
  	           if(res.result){
  	        	 alert('上传成功');
  	        	$("#head").attr('src','/static/user/' + res.id);
  	           } else {
  	        	   alert(res.msg);
  	           }
  	        },
  	        progressall: function (e, data) {
  	            var progress = parseInt(data.loaded / data.total * 100, 10);
  	            $('#progress .progress-bar').css(
  	                'width',
  	                progress + '%'
  	            );
  	        }
   	    });
    });
/*]]>*/
</script>
</body>
</html>
